// import AuthRoute from '@/components/auth'
// import Layout from '@/pages/layout'
// import Home from '@/pages/home'
//import Login from '@/pages/login'
import { lazy } from 'react'
import AuthRoute from '@/components/auth'
const Login = lazy(() => import('@/pages/login'))
const Layout = lazy(() => import('@/pages/layout'))
const Home = lazy(() => import('@/pages/home'))
const Article = lazy(() => import('@/pages/article'))
const Publish = lazy(() => import('@/pages/publish'))

//const Home = lazy(() => import('@/pages/home'))
// import NotFound from '@/pages/404'
const NotFound = lazy(() => import('@/pages/404'))

export const routes = [
  {
    path: '/',
    //element: <Layout />,  //有token就返回主页 无token就跳转登录
    element: <AuthRoute elementss={<Layout />} />,
    children: [
      { path: '/', element: <Home /> },
      { path: '/article', element: <Article /> },
      { path: '/publish/*', element: <Publish /> },
    ],
  },
  {
    path: '/login',
    element: <Login />,
  },
  {
    path: '*',
    element: <NotFound />,
  },
]
